{% extends "admin/base_site.html" %}
{% load i18n %}

{% block extrastyle %}
<style type="text/css">

#customLinks{
    position:absolute;
    margin-left:40%;
 	top:10px;
 	z-index:1;
}

#customLinks a:hover{
    color: white;
}

#content{
    color: #000;
}
</style>
{% endblock %}


{% block breadcrumbs %}
<div id="breadcrumbs">
    <a href="../../../">{% trans "Home" %}</a> &rsaquo;
    <a href="../../">{{ app_label|capfirst|escape }}</a> &rsaquo;
    {% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} &rsaquo; Create Custom Rules
</div>
{% endblock %}

{% block title %}Create Custom Rules{% endblock %}

{% block content %}
<h4>Rules in System </h4>
<p> These are the rules in the system. Rules can result in recommendations being provided to the user, questions being marked as redundant and questions being answered imlicitly.</p>

{% for rule in rule_list %}
<br />
{% autoescape off %}
{{ rule }}
<form action="{% url deleterule %}" method="post">
{% csrf_token %}
<input type="hidden" name="deleterule" value="{{ rule }}" />
<input type="submit" value="Delete rule" />
</form>
{% endautoescape %}
<br />
{% endfor %}
<br />
<hr>
<br />
<h4>Create a rule</h4>
<p> To create a rule, select answers from the drop down boxes and then select the outcome. An outcome can either be a recommendation, making a question redundant or implicitly answering a question or a any combination of those three. </p>
<br />
<br />

<form action="./" method="post">
    {% csrf_token %}
    Choose an answer:
    <br />
    <select name="part1">
        {% for a in answer_list %}
            <option value="{{a.id}}" selected="selected">{{a}}</option>
        {% endfor %}
    </select>
    <br />
    Choose the boolean operator:
    <br />
    <select name="boolpart">
        {% for b in bool_list %}
            <option value="{{b}}" selected="selected">{{b}}</option>
        {% endfor %}
    </select>
    <br />
    Choose an answer:
    <br />
    <select name="part2">
        {% for a in answer_list %}
            <option value="{{a.id}}" selected="selected">{{a}}</option>
        {% endfor %}
    </select>
    <br />
    <br />
        Triggers:
    <br />
    <br />
    Choose a recommendation:
    <br />
    <select name="result1">
        {% for r in rec_list %}
            <option value="{{r.id}}" selected="selected">{{r}}</option>
        {% endfor %}
    </select>
    <br />
    Choose an question to be answered implicitly:
    <br />
    <select name="result2">
        {% for a in answer_list %}
            <option value="{{a.id}}" selected="selected">{{a}}</option>
        {% endfor %}
    </select>
    <br />
    Choose a question to be made redundant:
    <br />
    <select name="result3">
        {% for q in question_list %}
            <option value="{{q.id}}" selected="selected">{{q}}</option>
        {% endfor %}
    </select>
    <br />
    <br />
    
    <input type="submit" value="Save rule" />

</form>


{% endblock %}
